import Vue from 'vue'
import Vuex from 'vuex'

Vue.use(Vuex)

export default new Vuex.Store({
    state: {
        navflag: true, //控制脚步显示隐藏的state
        nowVideo: "", //视频播放地址
        totalvideo: [] //当前课程的总视频
    },
    mutations: {
        changeFlag(state, flag) { //改变脚步显示隐藏的mutations
            state.navflag = flag;
        },
        cleartotalvideo(state) {
            state.totalvideo = []
        },
        changeNowVideo(state, vurl) {
            state.nowVideo = vurl;
        },
        changeTotalVideo(state, list) {
            state.totalvideo = [...state.totalvideo, ...list]
            console.log(state.totalvideo)
            state.nowVideo = state.totalvideo[0].Vurl;
        }
    },
    actions: {},
    modules: {}
})